package com.school.service;

import com.school.pojo.Student;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Date;
import java.util.Locale;

public class test {
    @Test
    public  void test1() throws ParseException {
         ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
         studentService service = context.getBean("studentServiceImpl", studentService.class);
         String names="123123123123";;
         for(int i=0,j=3;i<names.length();i+=3){
             System.out.println(names.substring(i,i+3));
             long  timestamp = new SimpleDateFormat("yyyy-MM-dd").parse("2022-02-0"+j).getTime();
             service.insertStudent(new Student(0,names.substring(i,i+3),"123aD",new Date(timestamp),null));
             j++;
         }

    }
}
